const PREFIX = 'FRONT_';
import Cookies from "js-cookie";
/**
 * 存储lCookie
 */
export const setCookie = (name, content,expires,domain) => {
    if (!name) return;
    if (typeof content !== 'string') {
        content = JSON.stringify(content);
    }
	if(expires){
		Cookies.set(PREFIX+name, content, {
			expires: expires,
			domain: domain,
		});
	}else{
		Cookies.set(PREFIX+name,content);
	}
}

/**
 * 获取Cookie
 */
export const getCookie = name => {
    if (!name) return;
    let v = Cookies.get(PREFIX+name);
    if (v == null) {
        return "";
    }
    return v;
}

/**
 * 删除Cookie
 */
export const removeCookie = name => {
    if (!name) return;
	Cookies.remove(PREFIX+name);
}

